<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!--     <link rel="shortcut icon" href="../../assets/ico/favicon.png"> -->

<title>SGI</title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap-3.1.1.css" rel="stylesheet" media="screen">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="../../assets/js/html5shiv.js"></script>
      <script src="../../assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
	<%@include file="header.jsp"%>

	<div class="container">
		<%
			if (((String) request.getAttribute("ERROR_MENSAJE")) != null) {
		%>
		<div class="alert alert-danger">${ERROR_MENSAJE}</div>
		<%
			}
		%>

		<%
			if (((String) request.getAttribute("SUCCESS_MENSAJE")) != null) {
		%>
		<div class="alert alert-success">${SUCCESS_MENSAJE}</div>
		<%
			}
		%>


		<p>
			<strong>Mantenimiento de Ideas &gt; Discucion</strong>
		</p>

		<form id="form1" name="form1" method="post"
			action="DiscucionCrearServlet" class="form-horizontal" role="form">
			<p>
				<input type="hidden" name="id_idea"
					value="<%=(String) request.getAttribute("id_idea")%>" id="id_idea" />
				Nueva Discucion: <label> <textarea id="texto" name="texto"
						rows="2" cols="50"></textarea>
				</label> <label> <input name="button2" id="button2" value="Crear"
					type="submit" />
				</label>
			</p>
		</form>
		<div class="table-responsive">


			<%@page import="java.util.*, com.jnetwork.modelo.Discucion"%>
			<%
				Collection<Discucion> arreglo = (ArrayList<Discucion>) request
						.getAttribute("discuciones");
				if (arreglo != null) {
					int i = 1;
					for (Discucion x : arreglo) {
			%>

				<%
					out.print(x.getUsuario().getNombres());
				%>
				dice: <br />
				<%
					out.print(x.getTexto());
				%><br />
				<%
					if (x.getDiscucionesHijo() != null) {

								for (Discucion x2 : x.getDiscucionesHijo()) {

									out.print(x2.getUsuario().getNombres());
				%>
				respondio: <br />
				<%
					out.print(x2.getTexto());
				%><br />

				<%
					}
							}
				out.print("<form id=form_\""+x.getId()+"\" name=\"form_"+x.getId()+"\" method=\"post\" action=\"DiscucionHijoCrearServlet?id_discucion="+x.getId()+"\" class=\"form-horizontal\" role=\"form\">");
				out.print("<p>");
				
				out.print("<input type=\"hidden\" name=\"id_discucion_"+x.getId()+"\" value=\""+x.getId()+"\" id=\"id_discucion_"+x.getId()+"\" />");
				
				out.print("<input type=\"hidden\" name=\"id_idea_"+x.getId()+"\" value=\""+x.getId()+"\" id=\"id_idea_"+x.getId()+"\" />");
				
				out.print("Nueva Respuesta: <label> <textarea id=\"texto_"+x.getId()+"\" name=\"texto_"+x.getId()+"\" rows=\"2\" cols=\"50\"></textarea></label> ");		
						 
				out.print("<label> <input name=\"button2_"+x.getId()+"\" id=\"button2_"+x.getId()+"\" value=\"Responder\" type=\"submit\" /></label>");	
					
				out.print("</p>");
				out.print("</form>");
				%>
			
				
			
		

			<%
				}
				}
			%>

		</div>

		<!-- Site footer -->
		<div class="footer">
			<p>&nbsp;</p>
			<p>&copy; JNetwork 2014</p>
		</div>

	</div>
	<!-- /container -->




	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->

	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="js/jquery-1.10.2.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="js/bootstrap-3.1.1.js"></script>
</body>
</html>
